package com.bugman.utils;

import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

/**
 *
 * @author Flashman
 */
public class MD5Utils {
    public static String hashStringByMD5(String string){
		String hashword = null;
		try {
			 MessageDigest md5 = MessageDigest.getInstance("MD5");
			 md5.update(string.getBytes());
			 BigInteger hash = new BigInteger(1, md5.digest());
			 hashword = hash.toString(16);
		 } catch (NoSuchAlgorithmException e) {
			 System.out.println("Zadny algoritmus pro MD5!!!");
		 }
		 return hashword;
	}
}
